package core.compenent
{
	import config.RekooConfig;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	
	import mx.controls.Image;

	public class RecommandImage extends Image
	{
		private var _recommand:int = -1;
		private var recommandChanged:Boolean = false;
		private var starImage:BitmapData = null;
		public function RecommandImage()
		{
			super();
		}
		
		public function set recommand(value:int):void
		{
			if(_recommand != value)
			{
				_recommand = value;
				recommandChanged = true;
				invalidateProperties();
			}
			
		}
		
		override public function get toolTip():String{
			return ["无人问津","太差了","很差劲","差劲","较差劲","一般般","还好","不错","经典","经典中的经典"][_recommand];
		}
		
		override protected function commitProperties():void
		{
			super.commitProperties();
			if(recommandChanged){
				this.source = new Bitmap(RekooConfig.getInstance().getStarData(_recommand));
				recommandChanged = false;
			}
		}
	}
}